<script setup lang="ts">
import ResultTable from "@/components/micro/ResultTable.vue";
import {GetPatternMatchResult} from "@/api/micro";
import {onMounted, ref} from "vue";

type TableDataType = {
  key: number,
  pattern_name: string,
  cybertwin_label: string,
  pattern_graph: string,
  analyse_time: string,
  invoke_time: string,
}

const tableData = ref<TableDataType[]>([]);

const getResultsAndSetToTableData = async () => {
  let { data } = await GetPatternMatchResult();

  // item: {
//   "ID": 1,
//   "PatternID": 1,
//   "CybertwinID": 0,
//   "CybertwinLabel": "simct",
//   "InvokeTime": "2025-05-11T01:44:42.202044",
//   "AnalyseTime": "2025-05-11T01:44:42.2126",
//   "GraphData": "eyJlZGdlcyI6IFt7ImxhYmVsIjogIkhUVFAgR0VUIC9mb28iLCAic291cmNlIjogImEiLCAidGFyZ2V0IjogImIifV0sICJub2RlcyI6IFt7ImlkIjogImEiLCAibGFiZWwiOiAic3ZjM34vdG9zdmM0In0sIHsiaWQiOiAiYiIsICJsYWJlbCI6ICJzdmM0fi9zdmM0In1dfQ=="
// }
  tableData.value = data;
}

onMounted(() => {
  getResultsAndSetToTableData();
})


</script>

<template>
  <h2>微服务异常调用链感知</h2>
  <ResultTable :result="tableData"/>
</template>

<style scoped>

</style>
